package ioperation;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class Find implements IOperation {
    @Override
    public void work(BookList bookList) {
        System.out.println("寻找图书");
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入书名");
        String name = scan.next();
        for (int i = 0; i < bookList.getUsedsize(); i++) {
            Book book = bookList.getBook(i);
            if(book.getName().equals(name)){
                System.out.println(book);
                return;
            }
        }
        System.out.println("没有这本书");

    }
}
